<?php
/**
 * Main.php
 *
 * This is an example of the main page of a website. Here
 * users will be able to login. However, like on most sites
 * the login form doesn't just have to be on the main page,
 * but re-appear on subsequent pages, depending on whether
 * the user has logged in or not.
 *
 * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
 * Last Updated: August 26, 2004
 */
include("include/session.php");
?>

<html>
<head>
	<title>Jpmaster77's Login Script</title>
	<link rel="stylesheet" href="css/bootstrap.min.css">
	<link rel="stylesheet" href="css/movienight.css">
</head>

<body>



<?php
/**
 * User has already logged in, so display relavent links, including
 * a link to the admin center if the user is an administrator.
 */
if($session->logged_in){
   echo "<h1>Logged In</h1>";
   echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
       ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
       ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
   if($session->isAdmin()){
      echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
   }
   echo "[<a href=\"process.php\">Logout</a>]";
}
else{
?>

<h1>Login</h1>

<div style="height: 100px;"></div>
		<form class="form-horizontal" action="process.php" method="POST">
			<fieldset>
				<?php $error = ($form->error("email") != ""); ?>
				
				<div class="control-group <?php if ($error) echo "error"; ?>">
					<label class="control-label" for="email">
						Email
					</label>
					<div class="controls">
						<input value="<?php echo $form->value("email"); ?>" type="text" id="email" name="email">
						<?php if ($error) : ?>
							<span class="help-inline"><?php echo $form->error("email"); ?></span>
						<?php endif; ?>
					</div>
				</div>
				
					
				<div class="control-group <?php if ($error) echo "error"; ?>">
					<label class="control-label" for="pass">
						Password
					</label>
					<div class="controls">
						<input value="<?php echo $form->value("pass"); ?>" type="password" id="pass" name="pass">
						<?php if ($error) : ?>
							<span class="help-inline"><?php echo $form->error("pass"); ?></span>
						<?php endif; ?>
					</div>
				</div>
				
			
			
				<div class="form-actions">
					<button type="submit" class="btn btn-primary">Login</button>
					<br><input type="checkbox" name="remember" <?php if($form->value("remember") != ""){ echo "checked"; } ?> </input> keep me logged in
					<br><span> not resgistered? <a href="mn_register.php">Sign Up</a></span>
					<br><span> forgot your password? <a href="mn_forgotPass.php">Click Here</a></span>
					
				</div>
				
				<input type="hidden" name="sublogin" value="1">
			</fieldset>
		</form>
		
		



<?php 
	}
?>
</body>
</html>